package com.moresir.validatetools.rules.list.str;

import com.moresir.validatetools.impl.Form;
import com.moresir.validatetools.rules.list.AbstractRule;
import org.apache.commons.lang3.StringUtils;

import java.util.Optional;

public class RuleNumeric extends AbstractRule {

    @Override
    public boolean isOkay(Form f) {
        Optional<String> s = f.getString(rule.getField());
        return s.filter(StringUtils::isNumeric).isPresent();
    }
}
